import { SPlayerGuildInfo } from "../../../../../Message/Game/SPlayerGuildInfo";
import { EGuildPosition } from "../../../../../Message/Game/EGuildPosition";
import { SGuildStructureInfo } from "../../../../../Message/Game/SGuildStructureInfo";
import { GuildConfig } from "../../../resource/GuildConfig";
import { GuildStructureConfig } from "../../../resource/GuildStructureConfig";
import { EGuildStructureType } from "../../../../../Message/Public/EGuildStructureType";
import { Language } from "../../../../../extend/language/Language";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { SPlayerItem } from "../../../../../Message/Public/SPlayerItem";
import { ItemData } from "../../../resource/info/ItemData";
import { ECategory } from "../../../../../Message/Public/ECategory";
type int = number;
//class GuildUtil
    
    export  class GuildUtil
    {
        

        public static isLeader(arg1: SPlayerGuildInfo): Boolean
        {
            if (arg1 && (arg1.position == EGuildPosition._EGuildLeader || arg1.position == EGuildPosition._EGuildDeputyLeader)) 
            {
                return true;
            }
            return false;
        }

        public static isUpgrading(arg1: SGuildStructureInfo): Boolean
        {
            var loc1=false;
            if (arg1 && arg1.leftTime > 0) 
            {
                loc1 = true;
            }
            return loc1;
        }

        public static getGuildMaxNum(arg1: int, arg2: int): int
        {
            var loc1=0;
            var loc3=null;
            var loc4=0;
            var loc2=GuildConfig.instance.getMaxNumByLevel(arg1);
            if (loc3) 
            {
                loc4 = GuildStructureConfig.instance.getInfoByType(EGuildStructureType._EGuildHall, arg2).effect;
            }
            loc1 = loc2 + loc4;
            return loc1;
        }

        public static getRoomNumByLevel(arg1: int): int
        {
            return arg1 * 5;
        }

        public static getRoomCostByLevel(arg1: int): int
        {
            return arg1 * 50;
        }

        public static getGuildPartyTypeName(arg1: int): string
        {
            var loc1=null;
            var loc2=null;
            if (arg1 != 0) 
            {
                if (arg1 != 1) 
                {
                    if (arg1 == 2) 
                    {
                        loc1 = Language.getString(57443);
                        loc2 = "#FF00FF";
                    }
                }
                else 
                {
                    loc1 = Language.getString(57442);
                    loc2 = "#00BEFF";
                }
            }
            else 
            {
                loc1 = Language.getString(57441);
                loc2 = "#00ff00";
            }
            return HTMLUtil.addColor(loc1, loc2);
        }

        public static getGuildTreeColor(arg1: int): string
        {
            var loc1="#00ff00";
            if (arg1 >= 1 && arg1 <= 3) 
            {
                loc1 = "#00ff00";
            }
            else if (arg1 >= 4 && arg1 <= 6) 
            {
                loc1 = "#00BEFF";
            }
            else if (arg1 >= 7 && arg1 <= 9) 
            {
                loc1 = "#FF00FF";
            }
            else if (arg1 == 10) 
            {
                loc1 = "#FF7902";
            }
            return loc1;
        }

        public static onFilterItem(arg1, arg2: int, arg3: Array<any>): Boolean
        {
            var loc2=null;
            var loc1;
            if (loc1 = arg1 as SPlayerItem) 
            {
                loc2 = new ItemData(loc1);
                if (GuildUtil.tabIndex == 0) 
                {
                    return true;
                }
                if (GuildUtil.tabIndex == 1) 
                {
                    return loc2.category == ECategory._ECategoryProp;
                }
                if (GuildUtil.tabIndex == 2) 
                {
                    return loc2.category == ECategory._ECategoryEquip || loc2.category == ECategory._ECategoryAmulet || loc2.category == ECategory._ECategorySpiritEquip;
                }
                if (GuildUtil.tabIndex == 3) 
                {
                    return loc2.category == ECategory._ECategoryJewel;
                }
            }
            return false;
        }

        public static getTypeByBossId(arg1: int): string
        {
            if (arg1 == 2139100) 
            {
                return "2";
            }
            return "1";
        }

        public static /* var */tabIndex: int;
    }
